#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void menu()
{
	printf("1.PALY\n");
	printf("0. EXIT\n");
}

void game()
{
	int i = rand() % 100 + 1;
	int guess = 0;
	while (1)
	{
		scanf("%d", &guess);
		if (guess < i)
		{
			printf("猜小了\n");
		}
		else if (guess > i)
		{
			printf("猜大了\n");
		}
		else
		{
			printf("猜对了\n");
			break;
		}
	}
}
int main()
{
	int input = 0;
	srand((unsigned int)time(NULL));
	do
	{
		menu();
		printf("请选择:");
		scanf("%d", &input);
		switch (input)
		{
		case 0:
			printf("游戏结束\n");
			break;
		case 1:
			game();
			break;
		default:
			printf("输入错误，请重新选择\n");
			break;
		}

	} while (input);
	return 0;
}


